package com.senthink.gl.business.userlog;

import com.senthink.gl.business.domain.entity.UserLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Optional;

/**
 * @author yuanpeng@senthink.com
 * @data 2018-01-30 9:44
 */
public interface UserLogRepository extends JpaRepository<UserLog, Long> , JpaSpecificationExecutor<UserLog> {

    /**
     * 获取到某用户上一条插入的日志
     * @param uid 用户唯一业务ID
     * @param operate 操作日志操作详情
     * @param ip 登录IP
     * @return
     */
    Optional<UserLog> findTopByUidAndOperateAndIpOrderByCreateTimeDesc(String uid, String operate, String ip);
}
